package org.com.blbl.School;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;
public class SchoolMapper extends Mapper<Object,Text,Text,IntWritable>{
    private final static IntWritable one = new IntWritable(1);
    private Text schoolName = new Text();

    @Override
    protected void map(Object key,Text value,Context context)throws IOException, InterruptedException {
        String[] fields = value.toString().split(",");
        schoolName.set(fields[1].trim()); // 获取第二列数据
        context.write(schoolName, one);
    }
}
